home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2007 February / maximum-cd-2007-02.iso / main.dxr / Internal_1_main scripts.ls < prev    next >
Encoding:
Text File  |  2006-07-19  |  11.0 KB  |  389 lines

  1. global seed, noVideo, database, menuIndex, buttonIndex, fd, submenuIndex, currentAsset, Tile, videoIndex, firstTime, bannerIndex, bannerList, systemSpecs, vidLoaded, dbLoaded
  2.  
  3. on prepareMovie me
  4.   clearGlobals()
  5.   baRegister("David Cole", 2833894)
  6.   if the platform contains "Windows" then
  7.     fd = "\"
  8.     acrobatReaderPath = baFindApp("PDF")
  9.   else
  10.     fd = ":"
  11.     acrobatReaderPath = baFindApp("CARO")
  12.   end if
  13.   firstTime = 1
  14.   videoIndex = 0
  15.   menuIndex = 0
  16.   submenuIndex = 0
  17.   buttonIndex = 0
  18.   currentAsset = EMPTY
  19.   dbLoaded = 0
  20.   vidLoaded = 0
  21.   Tile = 0
  22.   noVideo = 0
  23.   bannerIndex = 1
  24.   bannerList = [:]
  25.   set the soundKeepDevice to 0
  26.   member(58).fileName = the pathname & fd & "assets" & fd & "video" & fd & "placeholder.mov"
  27.   member(167).fileName = the pathname & fd & "assets" & fd & "video" & fd & "placeholder.mov"
  28.   member(53).fileName = the pathname & fd & "assets" & fd & "placeholder.jpg"
  29.   member(141).fileName = the pathname & fd & "assets" & fd & "placeholder.jpg"
  30.   member(11).fileName = the pathname & fd & "assets" & fd & "banner_placeholder.gif"
  31.   member(80).fileName = EMPTY
  32.   getSystemSpecs()
  33.   member("textImporter").fileName = the pathname & "assets" & fd & "data" & fd & "content.txt"
  34.   seed = value(member("textImporter").text)
  35.   getBanners()
  36. end
  37.  
  38. on stopMovie me
  39.   go("black")
  40.   updateStage()
  41.   member(58).fileName = the pathname & fd & "assets" & fd & "video" & fd & "placeholder.mov"
  42.   member(167).fileName = the pathname & fd & "assets" & fd & "video" & fd & "placeholder.mov"
  43.   member(53).fileName = the pathname & fd & "assets" & fd & "placeholder.jpg"
  44.   member(141).fileName = the pathname & fd & "assets" & fd & "placeholder.jpg"
  45.   member(11).fileName = the pathname & fd & "assets" & fd & "banner_placeholder.gif"
  46.   member(80).fileName = EMPTY
  47. end
  48.  
  49. on parseForSpecs targetMem
  50.   o = offset("{specs}", member(targetMem).text)
  51.   if o then
  52.     member(targetMem).char[o..o + 6] = systemSpecs
  53.   end if
  54. end
  55.  
  56. on getRoot txt
  57.   o = offset("_thumbnail", txt)
  58.   if o = 0 then
  59.     return txt
  60.   else
  61.     return txt.char[1..o - 1]
  62.   end if
  63. end
  64.  
  65. on stripExtension txt
  66.   a = the itemDelimiter
  67.   the itemDelimiter = "."
  68.   s = txt.item[1]
  69.   repeat with i = 2 to txt.item.count - 1
  70.     s = s & "." & txt.item[i]
  71.   end repeat
  72.   the itemDelimiter = a
  73.   return s
  74. end
  75.  
  76. on stripFolder txt, fDelimiter
  77.   a = the itemDelimiter
  78.   the itemDelimiter = fDelimiter
  79.   if txt.char[txt.char.count] = fDelimiter then
  80.     delete char txt.char.count of txt
  81.   end if
  82.   s = txt.item[1..txt.item.count - 1]
  83.   the itemDelimiter = a
  84.   return s
  85. end
  86.  
  87. on parseText txt
  88.   a = EMPTY
  89.   repeat with i = 1 to txt.char.count
  90.     if txt.char[i] = RETURN then
  91.       a = a & QUOTE & "&RETURN&" & QUOTE
  92.       next repeat
  93.     end if
  94.     a = a & txt.char[i]
  95.   end repeat
  96.   return a
  97. end
  98.  
  99. on parseForURL targetMem
  100.   repeat with j = 1 to member(targetMem).text.word.count
  101.     if offset("{link:", member(targetMem).text.word[j]) then
  102.       embedLink(targetMem, j)
  103.     end if
  104.   end repeat
  105.   repeat with j = 1 to member(targetMem).text.word.count
  106.     if offset("http://", member(targetMem).text.word[j]) = 1 then
  107.       theword = member(targetMem).text.word[j]
  108.       if (theword.char[theword.char.count] = ".") or (theword.char[theword.char.count] = ")") then
  109.         member(targetMem).word[j].hyperlink = theword.char[1..theword.char.count - 1]
  110.       else
  111.         member(targetMem).word[j].hyperlink = member(targetMem).text.word[j]
  112.       end if
  113.       member(targetMem).word[j].color = rgb(200, 200, 255)
  114.       next repeat
  115.     end if
  116.     if offset("www.", member(targetMem).text.word[j]) = 1 then
  117.       theword = member(targetMem).text.word[j]
  118.       if (theword.char[theword.char.count] = ".") or (theword.char[theword.char.count] = ")") then
  119.         member(targetMem).word[j].hyperlink = "http://" & theword.char[1..theword.char.count - 1]
  120.       else
  121.         member(targetMem).word[j].hyperlink = "http://" & member(targetMem).text.word[j]
  122.       end if
  123.       member(targetMem).word[j].color = rgb(200, 200, 255)
  124.     end if
  125.   end repeat
  126. end
  127.  
  128. on embedLink targetMem, w
  129.   wordCount = 1
  130.   ww = w
  131.   str = EMPTY
  132.   myURL = EMPTY
  133.   hitLeftBracket = 0
  134.   hitColon = 0
  135.   hitDivider = 0
  136.   hitRightBracket = 0
  137.   failed = 0
  138.   repeat while hitDivider = 0
  139.     repeat with i = 1 to member(targetMem).text.word[ww].char.count
  140.       if (member(targetMem).text.word[ww].char[i] = ":") and (hitColon = 0) then
  141.         hitColon = 1
  142.         next repeat
  143.       end if
  144.       if (hitColon = 1) and (hitDivider = 0) then
  145.         if member(targetMem).text.word[ww].char[i] = "|" then
  146.           hitDivider = 1
  147.           exit repeat
  148.           next repeat
  149.         end if
  150.         str = str & member(targetMem).text.word[ww].char[i]
  151.       end if
  152.     end repeat
  153.     if hitDivider = 0 then
  154.       ww = ww + 1
  155.       str = str & " "
  156.       if member(targetMem).text.word.count < ww then
  157.         failed = 1
  158.         exit repeat
  159.       end if
  160.       wordCount = wordCount + 1
  161.     end if
  162.   end repeat
  163.   if failed = 0 then
  164.     repeat with k = i + 1 to member(targetMem).text.word[ww].char.count
  165.       if member(targetMem).text.word[ww].char[k] = "}" then
  166.         hitRightBracket = 1
  167.         exit repeat
  168.         next repeat
  169.       end if
  170.       myURL = myURL & member(targetMem).text.word[ww].char[k]
  171.     end repeat
  172.     if (hitRightBracket = 0) and (k = member(targetMem).text.word[ww].char.count) then
  173.       failed = 1
  174.     end if
  175.   end if
  176.   if failed = 0 then
  177.     put str into (member targetMem).word[w..ww]
  178.     member(targetMem).word[w..ww].hyperlink = myURL
  179.     member(targetMem).word[w..ww].color = rgb(200, 200, 255)
  180.   end if
  181. end
  182.  
  183. on refreshStates
  184.   repeat with i = 110 to 120
  185.     if sprite(i).visible = 1 then
  186.       if menuIndex <> 0 then
  187.         if findPos(seed[#mainmenu][menuIndex][#submenu][sprite(i).buttonNumber + buttonIndex], #selected) then
  188.           if seed[#mainmenu][menuIndex][#submenu][sprite(i).buttonNumber + buttonIndex][#selected] = 1 then
  189.             sprite(i).member = sprite(i).memDn
  190.             sprite(i + 1).foreColor = 255
  191.           else
  192.             sprite(i).member = sprite(i).mem
  193.             sprite(i + 1).foreColor = 0
  194.           end if
  195.         else
  196.           seed[#mainmenu][menuIndex][#submenu][sprite(i).buttonNumber + buttonIndex][#selected] = 0
  197.         end if
  198.       else
  199.         sprite(i).member = sprite(i).mem
  200.         sprite(i + 1).foreColor = 0
  201.       end if
  202.     end if
  203.     i = i + 1
  204.   end repeat
  205.   repeat with i = 127 to 143
  206.     if sprite(i).visible = 1 then
  207.       if menuIndex <> 0 then
  208.         if findPos(seed[#mainmenu][menuIndex][#submenu][sprite(i).buttonNumber + buttonIndex], #selected) then
  209.           if seed[#mainmenu][menuIndex][#submenu][sprite(i).buttonNumber + buttonIndex][#selected] = 1 then
  210.             sprite(i).member = sprite(i).memDn
  211.             sprite(i + 1).foreColor = 255
  212.           else
  213.             sprite(i).member = sprite(i).mem
  214.             sprite(i + 1).foreColor = 0
  215.           end if
  216.         else
  217.           seed[#mainmenu][menuIndex][#submenu][sprite(i).buttonNumber + buttonIndex][#selected] = 0
  218.         end if
  219.       else
  220.         sprite(i).member = sprite(i).mem
  221.         sprite(i + 1).foreColor = 0
  222.       end if
  223.     end if
  224.     i = i + 1
  225.   end repeat
  226. end
  227.  
  228. on getSystemSpecs
  229.   systemSpecs = RETURN & "Your System Configuration" & RETURN & " CPU: "
  230.   m = baCpuInfo("model")
  231.   v = baCpuInfo("vendor")
  232.   cpu = EMPTY
  233.   if v contains "Intel" then
  234.     v = "Intel"
  235.     case baCpuInfo("type") of
  236.       4:
  237.         cpu = "486"
  238.       5:
  239.         cpu = "Pentium"
  240.       6:
  241.         case m of
  242.           1:
  243.             cpu = "Pentium Pro"
  244.           3, 5:
  245.             cpu = "Pentium II"
  246.           6:
  247.             cpu = "Celeron"
  248.           7, 8, 11:
  249.             cpu = "Pentium III"
  250.           8, 10:
  251.             cpu = "Pentium III Xeon"
  252.           otherwise:
  253.             cpu = "Pentium"
  254.         end case
  255.       15:
  256.         cpu = "Pentium 4+"
  257.       otherwise:
  258.         cpu = EMPTY
  259.     end case
  260.   else
  261.     if v contains "AMD" then
  262.       v = "AMD"
  263.       case baCpuInfo("type") of
  264.         5:
  265.           case baCpuInfo("type") of
  266.             0, 1, 2, 3, 4, 5:
  267.               cpu = "K5"
  268.             6, 7:
  269.               cpu = "K6"
  270.             8:
  271.               cpu = "K6-II"
  272.             9:
  273.               cpu = "K6-III"
  274.             otherwise:
  275.               cpu = EMPTY
  276.           end case
  277.         6:
  278.           cpu = "K7 Athlon"
  279.         otherwise:
  280.           cpu = EMPTY
  281.       end case
  282.     else
  283.       cpu = EMPTY
  284.     end if
  285.   end if
  286.   speed = baCpuInfo("speed")
  287.   put "." after char 1 of speed
  288.   systemSpecs = systemSpecs & v & " " & cpu & " " & speed & "Ghz" & RETURN & " RAM: "
  289.   m = baMemoryInfo("ram") / 1024000
  290.   l = baDiskList()
  291.   pd = EMPTY
  292.   s = 0
  293.   repeat with i in l
  294.     if baDiskInfo(i, "type") = "Hard" then
  295.       ss = baDiskInfo(i, "free")
  296.       if ss > s then
  297.         s = ss
  298.         pd = i
  299.       end if
  300.     end if
  301.   end repeat
  302.   if (pd = EMPTY) or (s = 0) then
  303.     systemSpecs = systemSpecs & m & "MB" & RETURN
  304.   else
  305.     systemSpecs = systemSpecs & m & "MB" & RETURN & " Free Disk: (" & pd & ") " & baDiskInfo(pd, "free") / 1024000 & "/" & baDiskInfo(pd, "size") / 1024000 & "GB" & RETURN
  306.   end if
  307.   sys = _system.environmentPropList
  308.   systemSpecs = systemSpecs & " OS: " & sys[#osVersion].item[1] & RETURN
  309.   systemSpecs = systemSpecs & " DirectX Version: " & sys[#directXVersion] & RETURN
  310.   if sys[#internetConnected] = #online then
  311.     systemSpecs = systemSpecs & " Net Connection Detected" & RETURN
  312.   else
  313.     systemSpecs = systemSpecs & " No Net Connection Detected" & RETURN
  314.   end if
  315. end
  316.  
  317. on textify t
  318.   d = the itemDelimiter
  319.   the itemDelimiter = "."
  320.   tt = EMPTY
  321.   repeat with j = 1 to t.item.count - 1
  322.     tt = tt & t.item[j] & "."
  323.   end repeat
  324.   tt = tt & "txt"
  325.   the itemDelimiter = d
  326.   return tt
  327. end
  328.  
  329. on parsePath txt
  330.   a = the itemDelimiter
  331.   the itemDelimiter = "/"
  332.   s = txt.item[1]
  333.   repeat with i = 2 to txt.item.count
  334.     s = s & fd & txt.item[i]
  335.   end repeat
  336.   the itemDelimiter = a
  337.   return s
  338. end
  339.  
  340. on openDoc d
  341.   result = baOpenFile(d, "normal")
  342.   if the platform contains "Windows" then
  343.     win = baWindowList(EMPTY, "Acrobat", 0)
  344.     if win <> [] then
  345.       baActivateWindow(win[1])
  346.     end if
  347.   end if
  348.   if result < 32 then
  349.     case result of
  350.       2:
  351.         alert("The file could not be found: " & d)
  352.       3:
  353.         alert("The path could not be found: " & d)
  354.       31:
  355.         alert("The application could not be found: " & d)
  356.       otherwise:
  357.         alert("Error opening file: " & result & RETURN & d)
  358.     end case
  359.   end if
  360. end
  361.  
  362. on getBanners
  363.   if menuIndex = 0 then
  364.     if findPos(seed, #banners) <> VOID then
  365.       if bannerList <> seed[#banners] then
  366.         bannerList = seed[#banners]
  367.         bannerIndex = 1
  368.         sendAllSprites(#updateBanners)
  369.       end if
  370.     else
  371.       bannerList = []
  372.     end if
  373.   else
  374.     if submenuIndex = 0 then
  375.       if findPos(seed[#mainmenu][menuIndex], #banners) <> VOID then
  376.         bannerList = seed[#mainmenu][menuIndex][#banners]
  377.         bannerIndex = 1
  378.         sendAllSprites(#updateBanners)
  379.       end if
  380.     else
  381.       if findPos(seed[#mainmenu][menuIndex][#submenu][submenuIndex], #banners) <> VOID then
  382.         bannerList = seed[#mainmenu][menuIndex][#submenu][submenuIndex][#banners]
  383.         bannerIndex = 1
  384.         sendAllSprites(#updateBanners)
  385.       end if
  386.     end if
  387.   end if
  388. end
  389.